<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>

  <body>
    <main>
      <span>houdunren</span>
      <span>houdunren.com</span>
      <span>hdscmd.com</span>
    </main>
    <script>
      const str = "zkswww.hkhgsvdxfg";

      console.log(str.match(/\w+\.?\w+/));

      const main = document.querySelector("main");
      let reg = /<(span)>([\s\S]+?)<\/\1>/gi; //禁止贪婪只会匹配第一个span就结束
      console.dir(main.innerHTML.match(reg),'match方法-----------------');
      let hd = main.innerHTML.matchAll(reg);
      for (const item of hd) {
        console.log(item,'sada');
     
      }
    </script>
  </body>
</html>
